package com.juyu.miliao.common.pojo;

import java.time.LocalDate;
import javax.validation.constraints.NotNull;


public class DatePeriod {
	@NotNull
	private LocalDate startDate;
	@NotNull
	private LocalDate endDate;

	public DatePeriod(){
		
	}
	
	public DatePeriod(LocalDate date){
		startDate = date;
		endDate = date;
	}
	
	public DatePeriod(LocalDate startDate, LocalDate endDate){
		this.startDate = startDate;
		this.endDate = endDate;
	}
	
	public LocalDate getStartDate() {
		return startDate;
	}

	public void setStartDate(LocalDate startDate) {
		this.startDate = startDate;
	}

	public LocalDate getEndDate() {
		return endDate;
	}

	public void setEndDate(LocalDate endDate) {
		this.endDate = endDate;
	}

	public DateTimePeriod toDateTimePeriod(){
		DateTimePeriod dateTimePeriod = new DateTimePeriod();
		if(startDate != null)
			dateTimePeriod.setStartTime(startDate.atTime(0, 0, 0));
		if(endDate != null)
			dateTimePeriod.setEndTime(endDate.atTime(23, 59, 59));
		return dateTimePeriod;
	}
	
}
